//
//  NewsTitle.m
//  UI1_JSON 网易
//
//  Created by dllo on 16/8/9.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "NewsTitle.h"

@implementation NewsTitle
// 初始化
- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}
// 遍历构造器
+ (NewsTitle *)newsTitleWithDictionary:(NSDictionary *)dictionary {
    return [[self alloc] initWithDictionary:dictionary];
}
// 给model赋值时 如果找不到key (例如: key为template 这时在我们的model里找不到 对应的key 走下面赋值的方法)
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"template"]) {
        _news_template = value;
    }
}
// 取值
- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

- (NSString *)description {
    return [NSString stringWithFormat:@"%@", _tname];
}

@end
